package com.itasura.prototype;

import java.util.Hashtable;

/**
 * @author sailor wang
 * @date 2020/7/1 10:39 AM
 * @description
 */
public class ShapeContainer {
    private static Hashtable<String,Shape> shapeMap = new Hashtable<>();

    public static Shape getShape(String shapeId){
        return (Shape) shapeMap.get(shapeId).clone();
    }

    public static void initContainer(){
        Circle circle = new Circle();
        circle.setId("1");
        shapeMap.put(circle.getId(),circle);

        Square square = new Square();
        square.setId("2");
        shapeMap.put(square.getId(),square);

        Rectangle rectangle = new Rectangle();
        rectangle.setId("3");
        shapeMap.put(rectangle.getId(),rectangle);
    }
}